/**
 * @Author:  蓝建平
 * @Description:  Map
 * @Date:  2019/12/4
 */

void main()
{
  //1创建Map
  var map1={
    "firstName":"张",
    "lastName":"三丰",
    "age":200,
    "gendar":true
  };
  print(map1["firstName"]);
  var map2=new Map<String,int>();
  map2["math"]=98;
  map2["english"]=100;
  map2["science"]=100;
  map2["chinese"]=100;
  print(map2);

  var map3=const{"red":200,"green":125,"blue":234};
//  map3["red"]=245;
//  print(map3);//Unsupported operation: Cannot set value in unmodifiable Map
   map3=map2;
   print(map3);
   print(map3.length);
   print(map3.keys);
   print(map3.values);
   print(map3.containsKey("english"));
  map3.forEach(myPrint);
}

void myPrint(String key,int value)
{
  print("$key=$value");
}